(function() {
    Path.on("/__basename__.html", function(_current_location) {
        if (!App.get("loginer")) {
            myConfirm("请先登陆！！！", function() {
                Path.jump("/sign_in.html");
            }, function() {
                Path.jump("/main.html");
            });
            return;
        };
        var card_info = App.get("loginer.card_list")[0] ? App.get("loginer.card_list")[0].split("|") : false;
        if (!card_info) {
            myConfirm("您还没有会员卡！！！");
            Path.jump("/main.html");
            return;
        };
        var card_bus_id = card_info[0].split(":")[1];
        if (!card_bus_id == busInfo._id) {
            myConfirm("您的会员卡不能在此商城使用");
            Path.jump("/main.html");
            return;
        };
        var card_id = card_info[1].split(":")[1];
        // 加载会员卡信息
        coAjax.get(appConfig.card_factory.by_id + card_id, {
            bus_id: busInfo._id
        }, function(result) {
            App.set("$Cache.membercircle.memberinfo", result.result);
            // 加载会员卡商品列表
            coAjax.get(appConfig.goods.byIds, {
                goods_id_list: result.result.goods_list
            }, function(goods_resutl) {
                App.set("$Cache.membercircle.goods_list", goods_resutl.result);
            });
            console.log(result.result);
        });
    });
}());
